home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1996 May / cd joy 71No13.iso / pc / demos / eurosoc / source / euro_fix.cpp < prev    next >
Text File  |  1996-03-19  |  27KB  |  939 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <conio.h>
  5.  
  6. #include "eurodefs.h"
  7. #include "euro_fxd.h"
  8. #include "euro.equ"
  9. #include "euro_sym.h"
  10. #include "euro_def.h"
  11. #include "euro_var.h"
  12. #include "euro_grf.h"
  13. #include "euro_dsk.h"
  14. #include "euro_cnt.h"
  15. #include "euro_gen.h"
  16. #include "euro_rnd.h"
  17. #include "euro_int.h"
  18. #include "defines.h"
  19.  
  20. //********************************************************************************************************************************
  21.  
  22. void    DisplayRedrawButton( char Match )
  23.     {
  24.          if ( Match == 0 )
  25.         {
  26.             RedrawHandle        =     AddAnimation( 507, 180, 
  27.                              ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  28.                              0.0, REDRAW_BOX, CONT_ANIM );
  29.             RedrawHighlight        =      ControlOptionHighlight( -1, REDRAW_BOX, REDRAWdisp_BOX, 
  30.                              -1, RedrawHandle, BUTN_LBLS+Redraw );
  31.         }
  32.     }
  33.  
  34. //********************************************************************************************************************************
  35.  
  36. char FindNextFixtureTeam( char drawcode )
  37.     {
  38.         char    team    =    0;
  39.  
  40.         for ( char t=0; t < 16 ; t++ )
  41.             {
  42.                  if ( GroupDrawInfo[t]    == drawcode )
  43.                 {
  44.                     team    =    t;
  45.                     break;
  46.                 }            
  47.             }
  48.  
  49.         return (team);
  50.     }
  51.  
  52. //********************************************************************************************************************************
  53.  
  54. char FindTeamInLeague( char posn )
  55.     {
  56.         char    team    =    0;
  57.  
  58.         for ( char t=0; t < 16 ; t++ )
  59.             {
  60.                  if ( LeaguePositions[t]    == posn )
  61.                 {
  62.                     team    =    t;
  63.                     break;
  64.                 }            
  65.             }
  66.  
  67.         return (team);
  68.     }
  69.  
  70. //********************************************************************************************************************************
  71.  
  72. void    GroupFixturesPage( char MENU, signed char BOX )
  73.     {
  74.         if ( MENU == GROUP_FIXTURES && LogicState == RUN_FRONTEND )
  75.         {
  76.             if ( BOX == REDRAW_BOX && ButtonState != 0 )
  77.               {
  78.                 Animation_table[RedrawHandle].AnimationSpeed =
  79.                         WhichButton( ButtonState, 0.85);
  80.                 ChangeMenu    =    EURO_REDRAW;
  81.                      DeBounce      =     TRUE;
  82.               }                                     
  83.  
  84.             if ( BOX == NXT_MTCH_BOX && ButtonState != 0 )
  85.               {
  86.       
  87.             ///    tempory transfer to next match....
  88.  
  89.                 EUROteamA    =    FindNextFixtureTeam( Fixtures[MatchNumber].HomeTeam );
  90.                 EUROteamB    =    FindNextFixtureTeam( Fixtures[MatchNumber].AwayTeam );
  91.             ///
  92.                 Animation_table[NextMatchHandle].AnimationSpeed = 
  93.                         WhichButton( ButtonState, 0.85);
  94.                 
  95.                 if ( MatchNumber<24 )
  96.                     ChangeMenu    =    NEXT_MATCH;
  97.                 else
  98.                     ChangeMenu    =    QUALIFIERS;
  99.  
  100.                      DeBounce          =     TRUE;
  101.               }                                     
  102.     
  103.         RedrawHighlight       = ControlOptionHighlight( BOX, REDRAW_BOX, REDRAWdisp_BOX, RedrawHighlight, 
  104.                      RedrawHandle, BUTN_LBLS+Redraw );
  105.         NextMatchHighlight = ControlOptionHighlight( BOX, NXT_MTCH_BOX, NXT_MTCHdisp_BOX, NextMatchHighlight,
  106.                     NextMatchHandle, BUTN_LBLS+NextMatch );
  107.         }
  108.     }               
  109.  
  110. //********************************************************************************************************************************
  111.  
  112. void CalculateLeagueTables()
  113.     {
  114.         //…ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕª 
  115.         //∫                                                              ∫
  116.         //∫ VERBOSE INFORMATION, DISPLAYS LEAGUE TABLE DATA IF REQUESTED ∫
  117.         //∫                                                              ∫
  118.         //»ÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕÕº 
  119.  
  120.         
  121.         if ( EUROverbose != 0 )
  122.         {
  123.             printf("\n  LEAGUE TABLE CALCULATION DATA:\n\n");
  124.             fflush(stdout);                
  125.             printf("    Points for a win:   %d\n", WinPts);
  126.             fflush(stdout);                
  127.             printf("    Points for a draw:  %d\n", DrawPts);
  128.             fflush(stdout);                
  129.         }
  130.  
  131.  
  132.         for ( char t=0; t < 16 ; t++ )
  133.         {
  134.             LeaguePositions[t]    =    GroupDrawInfo[t];    //t;
  135.             LeagueTable[t].points    =    
  136.                 ((LeagueTable[t].won*WinPts) + (LeagueTable[t].drew*DrawPts));
  137.             LeagueTable[t].goalDiff    =    
  138.                 (LeagueTable[t].goalsFor-LeagueTable[t].goalsAgainst);
  139.  
  140.  
  141.         if ( EUROverbose != 0 )
  142.   
  143.             printf(" (%d)      W: %d   D: %d   L: %d   Gf: %d   Ga: %d   Pts: %d       %s\n", 
  144.                         LeaguePositions[t],
  145.                         LeagueTable[t].won, LeagueTable[t].drew, LeagueTable[t].lost,
  146.                         LeagueTable[t].goalsFor, LeagueTable[t].goalsAgainst,
  147.                         LeagueTable[t].points,    GetTEXT(TEAM_NMES+t ) );
  148.             fflush(stdout);                
  149.         }
  150.  
  151.  
  152.  
  153.     char    SwapTemp;
  154.  
  155.     for ( char scans = 0; scans < 16; scans++ )
  156.         {
  157.              for ( char teama = 0; teama < 16; teama++ )
  158.             {
  159.  
  160.                  for ( char teamb = 0; teamb < 16; teamb++ )
  161.                 {
  162.  
  163.                 if ( teama != teamb && 
  164.                     ( (GroupDrawInfo[teama] & 12) == (GroupDrawInfo[teamb] & 12)) )
  165.                          {
  166.                 
  167.  
  168.                      if ( 
  169.                     ( LeagueTable[ teama ].points < LeagueTable[ teamb ].points && 
  170.                       LeaguePositions[ teama ] < LeaguePositions[ teamb ] )
  171.  
  172.                          ||    ( LeagueTable[ teama ].points == LeagueTable[ teamb ].points && 
  173.                           LeagueTable[ teama ].won < LeagueTable[ teamb ].won && 
  174.                           LeaguePositions[ teama ] < LeaguePositions[ teamb ] )
  175.                            
  176.                          || ( LeagueTable[ teama ].points == LeagueTable[ teamb ].points && 
  177.                           LeagueTable[ teama ].won == LeagueTable[ teamb ].won && 
  178.                           LeagueTable[ teama ].goalDiff < LeagueTable[ teamb ].goalDiff && 
  179.                           LeaguePositions[ teama ] < LeaguePositions[ teamb ] ) 
  180.                             )       
  181.                         {
  182.  
  183.                             SwapTemp = LeaguePositions[ teamb ];
  184.                             LeaguePositions[ teamb ] = 
  185.                                 LeaguePositions[ teama ];
  186.                             LeaguePositions[ teama ] = 
  187.                                 SwapTemp;
  188.  
  189.                                }
  190.  
  191.                     }
  192.                 }
  193.             }
  194.         }
  195.     }
  196.  
  197. //********************************************************************************************************************************
  198.  
  199. void DisplayLeagueTables()
  200.     {    
  201.  
  202.     char    PAL, PAL2;
  203.     short team;
  204.     char  *ammount;
  205.     for ( char h=0; h < 16 ; h++ )
  206.         {
  207.             DisplayString(
  208.                 (GroupFixtureDEFN[h].xposn)-
  209.                     (PixelLengthOfString(GetTEXT( GroupFixtureDEFN[h].string), SMALL_FONT ) /2 ), 
  210.                 GroupFixtureDEFN[h].yposn,
  211.                       GetTEXT( GroupFixtureDEFN[h].string ),
  212.                 SMALL_FONT, 22, NO_BOX, 
  213.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  214.  
  215.                 team    =    (short)FindTeamInLeague(h);
  216.  
  217.                        PAL    =    LeagueColourOffsets[team];
  218.                 PAL2    =    15;
  219.  
  220.                 if ( MatchNumber > 23 && (h & 2) )
  221.                 {
  222.                     PAL    =    22;
  223.                     PAL2    =    22;
  224.                 }
  225.  
  226.                 DisplayString( 
  227.                 LeaguePosnDEFN[h].xposn,
  228.                 LeaguePosnDEFN[h].yposn,
  229.                 GetTEAMname( team, 11 ),
  230.                 SMALL_FONT, PAL, NO_BOX, 
  231.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  232.  
  233.                 itoa( LeagueTable[team].won, ammount, 10);
  234.                 DisplayString( 
  235.                 WinPosnDEFN[h].xposn - 
  236.                     (PixelLengthOfString( ammount, SMALL_FONT ) /2 ), 
  237.                 WinPosnDEFN[h].yposn,
  238.                 ammount,
  239.                 SMALL_FONT, PAL2, NO_BOX, 
  240.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  241.  
  242.                 itoa( LeagueTable[team].drew, ammount, 10);
  243.                 DisplayString( 
  244.                 DrawPosnDEFN[h].xposn - 
  245.                     (PixelLengthOfString( ammount, SMALL_FONT ) /2 ), 
  246.                 DrawPosnDEFN[h].yposn,
  247.                 ammount,
  248.                 SMALL_FONT, PAL2, NO_BOX, 
  249.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  250.                 itoa( LeagueTable[team].lost, ammount, 10);
  251.                 DisplayString( 
  252.                 LosePosnDEFN[h].xposn - 
  253.                     (PixelLengthOfString( ammount, SMALL_FONT ) /2 ), 
  254.                 LosePosnDEFN[h].yposn,
  255.                 ammount,
  256.                 SMALL_FONT, PAL2, NO_BOX, 
  257.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  258.                 itoa( LeagueTable[team].points, ammount, 10);
  259.                 DisplayString( 
  260.                 PointsPosnDEFN[h].xposn - 
  261.                     (PixelLengthOfString( ammount, SMALL_FONT ) /2 ), 
  262.                 PointsPosnDEFN[h].yposn,
  263.                 ammount,
  264.                 SMALL_FONT, PAL2, NO_BOX, 
  265.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  266.         }
  267.     }
  268.  
  269. //********************************************************************************************************************************
  270.  
  271. void DisplayLeagueFixtures( char Match )
  272.     {          
  273.         char    NextMtch = Match;
  274.         char    PAL;
  275.         char    ammount[5];
  276.  
  277.         if ( Match>23)           // if displaying final tables then make slight alteration
  278.             Match = 16;    // so fixtures don't zoom ahead....
  279.  
  280.         Match&=    (31-7);
  281.  
  282.         for ( char f=0; f < 8 ; f++ )
  283.         {
  284.  
  285.             PAL    =    22;
  286.         
  287.             if ( Match == NextMtch )
  288.     
  289.                 PAL = 15;
  290.  
  291.  
  292.             if ( Match<NextMtch )
  293.             {            
  294.             
  295.             char ResText[128];
  296.  
  297.             strcpy(ResText, GetTEAMname( FindNextFixtureTeam( Fixtures[Match].HomeTeam ), 11) );
  298.             strcat(ResText, " ");
  299.                    itoa( (int)Results[Match].HomeScore, EUROammount, 10);
  300.             strcat(ResText, EUROammount);
  301.  
  302.             DisplayString(
  303.                 Fixtures[Match].fixXposn-
  304.                            (PixelLengthOfString( ResText,SMALL_FONT) /2 ),
  305.                 Fixtures[Match].fixYposn,
  306.                       ResText,
  307.                 SMALL_FONT, 29, NO_BOX, 
  308.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  309.  
  310.             strcpy(ResText, GetTEAMname( FindNextFixtureTeam( Fixtures[Match].AwayTeam ), 11) );
  311.             strcat(ResText, " ");
  312.                    itoa( (int)Results[Match].AwayScore, EUROammount, 10);
  313.             strcat(ResText, EUROammount);
  314.  
  315.             DisplayString(
  316.                 (Fixtures[Match].fixXposn+116)-
  317.                            (PixelLengthOfString( ResText,SMALL_FONT) /2 ),
  318.                 Fixtures[Match].fixYposn,
  319.                       ResText,
  320.                 SMALL_FONT, 29, NO_BOX, 
  321.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  322.             }
  323.             
  324.             else
  325.  
  326.             {
  327.  
  328.             DisplayString(
  329.                 Fixtures[Match].fixXposn-
  330.                     (PixelLengthOfString( 
  331.                 GetTEAMname( FindNextFixtureTeam( Fixtures[Match].HomeTeam ), 11), SMALL_FONT ) /2 ),
  332.                 Fixtures[Match].fixYposn,
  333.                       GetTEAMname( FindNextFixtureTeam( Fixtures[Match].HomeTeam ), 11), SMALL_FONT, 
  334.                 PAL, NO_BOX, 
  335.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  336.  
  337.             DisplayString(
  338.                 (Fixtures[Match].fixXposn+116)-
  339.                     (PixelLengthOfString( 
  340.                 GetTEAMname( FindNextFixtureTeam( Fixtures[Match].AwayTeam), 11), SMALL_FONT ) /2 ),
  341.                 Fixtures[Match].fixYposn,
  342.                       GetTEAMname( FindNextFixtureTeam( Fixtures[Match].AwayTeam), 11), SMALL_FONT, 
  343.                 PAL, NO_BOX, 
  344.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  345.  
  346.             DisplayString( 
  347.                 (Fixtures[Match].fixXposn+58)-
  348.                 (PixelLengthOfString(GetTEXT( VRUS_LBLE ), SMALL_FONT ) /2 ), 
  349.                 Fixtures[Match].fixYposn,
  350.                       GetTEXT( VRUS_LBLE ),
  351.                 SMALL_FONT, PAL, NO_BOX, 
  352.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  353.             }
  354.  
  355.  
  356.             Match++;
  357.         }
  358.     }
  359.  
  360. //********************************************************************************************************************************
  361. //
  362. //void    DisplayVersusList( char Match )
  363. //    {
  364. //
  365. //    char    NextMtch = Match;
  366. //           Match&=    (31-7);
  367. //
  368. //    for ( char v=0; v < 8 ; v++ )
  369. //        {
  370. //
  371. //            if ( Match >= NextMtch )
  372. //            {            
  373. //
  374. //            DisplayString( VersusPosnDEFN[v].xposn - (PixelLengthOfString(GetTEXT( VRUS_LBLE ), SMALL_FONT ) /2 ), 
  375. //                VersusPosnDEFN[v].yposn,
  376. //                      GetTEXT( VRUS_LBLE ),
  377. //                SMALL_FONT, 22, NO_BOX, 
  378. //                &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  379. //            }
  380. //       
  381. //        Match++;
  382. //
  383. //        }
  384. //    }
  385. //
  386. //********************************************************************************************************************************
  387.  
  388.  
  389. void EuroReDraw( char MENU, signed char BOX )
  390.     {
  391.         signed char DrawnTeam, venue;
  392.  
  393.         if ( MENU == EURO_REDRAW )
  394.         {
  395.  
  396.         DefaultdrawHighlight =  ControlOptionHighlight( BOX, DEFAULT_BOX,
  397.                    DEFAULTdisp_BOX, DefaultdrawHighlight, 
  398.                     DefaultHandle, BUTN_LBLS+Default );
  399.  
  400.             if ( BOX == DEFAULT_BOX && ButtonState != 0 && LogicState == RUN_FRONTEND )
  401.               {
  402.                 memcpy( &GroupDrawInfo[0], &GroupDrawDefaultInfo[0], 16 );
  403.                 Animation_table[DefaultHandle].AnimationSpeed = 
  404.                         WhichButton( ButtonState, 0.85);
  405.                 ChangeMenu    =    GROUP_FIXTURES;
  406.                      DeBounce      =     TRUE;
  407.               }                                     
  408.  
  409.             if ( EuroReDrawCounter <= 0.0 )
  410.             {
  411.  
  412.                 if ( EuroReDrawFlag == 22 )
  413.                 {
  414.                     if ( BOX == GRP_FIX_BOX && ButtonState == LEFT_BUTTON && LogicState == RUN_FRONTEND )
  415.                       {
  416.                         Animation_table[GrpFixHandle].AnimationSpeed = 
  417.                             WhichButton( ButtonState, 0.85);
  418.                         ChangeMenu    =    GROUP_FIXTURES;
  419.                              DeBounce      =     TRUE;
  420.                       }                                     
  421.  
  422.                 RedrawdoneHighlight =  ControlOptionHighlight( BOX, GRP_FIX_BOX,
  423.                        GRP_FIXdisp_BOX, RedrawdoneHighlight, 
  424.                         GrpFixHandle, BUTN_LBLS+Done );
  425.  
  426.                 }
  427.                 
  428.                 if ( EuroReDrawFlag == 21 )
  429.                 {
  430.                     char c;
  431.                     for ( char t=0; t < 16 ; t++ )             
  432.                         {
  433.                         c         = GroupDrawInfo[t] / 4;
  434.                         GroupDrawInfo[t] = (GroupDrawInfo[t] & 3) +  (GroupVenues[c]*4);
  435.                         }                        
  436.                     EuroReDrawFlag++;
  437.  
  438.                     GrpFixHandle  =     AddAnimation( 446, 425, 
  439.                                    ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  440.                                     0.0, GRP_FIX_BOX, RUN_ONCE );
  441.                     Animation_table[GrpFixHandle].Counter    =    6.0;
  442.                     Animation_table[GrpFixHandle].AnimationSpeed = 0.85;
  443.                     
  444.                     RedrawdoneHighlight =  ControlOptionHighlight( -1, GRP_FIX_BOX,
  445.                            GRP_FIXdisp_BOX, -1, 
  446.                             GrpFixHandle, BUTN_LBLS+Done );
  447.                 }
  448.  
  449.                 if ( EuroReDrawFlag > 16 && EuroReDrawFlag < 21 )
  450.                 {
  451.                     if ( GroupVenues[ (EuroReDrawFlag-17) ] != -1 )
  452.                         EuroReDrawFlag++;
  453.                     else
  454.  
  455.                     {                        
  456.                         venue    = (char)( GetRnd2() & 3 );
  457.  
  458.                         if ( GroupVenues[0] != venue &&  
  459.                              GroupVenues[1] != venue &&
  460.                              GroupVenues[2] != venue &&
  461.                              GroupVenues[3] != venue )
  462.                         {
  463.                             char    v    =    (EuroReDrawFlag-17);
  464.                             
  465.                             GroupVenues[v]  = venue;
  466.  
  467.                             CopyFromBACKtoPSEUDObuffer(
  468.                                 &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  469.                                   ReDrawHeadPosnDEFN[v].xposn-84,
  470.                                   ReDrawHeadPosnDEFN[v].yposn-5,
  471.                                 168, 28 );
  472.         
  473.                              DisplayString(
  474.                                    ReDrawHeadPosnDEFN[v].xposn-
  475.                                    ((PixelLengthOfString( GetTEXT( VNUE_NMES+(venue*2) ), 
  476.                                    SMALL_FONT )) /2),
  477.                                    ReDrawHeadPosnDEFN[v].yposn-7,
  478.                                   GetTEXT( VNUE_NMES+(venue*2) ),
  479.                                   SMALL_FONT, 
  480.                                   15,
  481.                                   NO_BOX, 
  482.                                   &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  483.  
  484.                              DisplayString(
  485.                                    ReDrawHeadPosnDEFN[v].xposn-
  486.                                    ((PixelLengthOfString( GetTEXT( VNUE_NMES+Birmingham+(venue*2) ), 
  487.                                    SMALL_FONT )) /2),
  488.                                    ReDrawHeadPosnDEFN[v].yposn+8,
  489.                                   GetTEXT( VNUE_NMES+Birmingham+(venue*2) ),
  490.                                   SMALL_FONT, 
  491.                                   15,
  492.                                   NO_BOX, 
  493.                                   &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  494.                     
  495.                             AddToDumpList( 
  496.                                   ReDrawHeadPosnDEFN[v].xposn-84,
  497.                                   ReDrawHeadPosnDEFN[v].yposn-7,
  498.                                   168, 32 );
  499.          
  500.                             EuroReDrawFlag++;
  501.                             EuroReDrawCounter    =    25;
  502.                         }
  503.  
  504.                     }
  505.  
  506.                  }
  507.  
  508.  
  509.  
  510.                 if ( EuroReDrawFlag==16 )
  511.                 {
  512.                     venue    = GroupDrawInfo[England] /4;
  513.                     EuroReDrawFlag    =    17;
  514.  
  515.                     for ( char v=0; v < 4 ; v++ )             
  516.                     {GroupVenues[v] =    -1;}
  517.  
  518.                     GroupVenues[venue] =    0;
  519.  
  520.                     CopyFromBACKtoPSEUDObuffer(
  521.                         &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  522.                           ReDrawHeadPosnDEFN[venue].xposn-84,
  523.                           ReDrawHeadPosnDEFN[venue].yposn-5,
  524.                             168, 28 );
  525.                      DisplayString(
  526.                        ReDrawHeadPosnDEFN[venue].xposn-
  527.                        ((PixelLengthOfString( GetTEXT( VNUE_NMES ), 
  528.                        SMALL_FONT )) /2),
  529.                        ReDrawHeadPosnDEFN[venue].yposn-7,
  530.                       GetTEXT( VNUE_NMES ),
  531.                       SMALL_FONT, 
  532.                       15,
  533.                       NO_BOX, 
  534.                       &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  535.  
  536.                      DisplayString(
  537.                        ReDrawHeadPosnDEFN[venue].xposn-
  538.                        ((PixelLengthOfString( GetTEXT( VNUE_NMES+Birmingham ), 
  539.                        SMALL_FONT )) /2),
  540.                        ReDrawHeadPosnDEFN[venue].yposn+8,
  541.                       GetTEXT( VNUE_NMES+Birmingham ),
  542.                       SMALL_FONT, 
  543.                       15,
  544.                       NO_BOX, 
  545.                       &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  546.             
  547.                     AddToDumpList( 
  548.                       ReDrawHeadPosnDEFN[venue].xposn-84,
  549.                       ReDrawHeadPosnDEFN[venue].yposn-7,
  550.                       168, 32 );
  551.  
  552.                     EuroReDrawCounter    =    25;
  553.                 }                    
  554.  
  555.  
  556.  
  557.                 if ( EuroReDrawFlag > 11 && EuroReDrawFlag < 16 )
  558.                 {
  559.                     DrawnTeam    =    (char)( GetRnd2() & 15);
  560.  
  561.  
  562.                     if ( (DrawnTeam == England ||        
  563.                          DrawnTeam == Spain ||
  564.                          DrawnTeam == Denmark ||
  565.                          DrawnTeam == Germany) &&
  566.                          GroupDrawInfo[DrawnTeam] == -1 )
  567.                         {
  568.                             GroupDrawInfo[DrawnTeam] = GroupDrawCode[EuroReDrawFlag];
  569.  
  570.                             DisplayString(
  571.                               ReDrawPosnDEFN[EuroReDrawFlag].xposn-
  572.                                   ((PixelLengthOfString( GetTEAMname( DrawnTeam, 11 ), 
  573.                                 MEDIUM_FONT )) /2),
  574.                               ReDrawPosnDEFN[EuroReDrawFlag].yposn,
  575.                                     GetTEAMname( DrawnTeam, 11 ),
  576.                                 MEDIUM_FONT, 
  577.                                 LeagueColourOffsets[DrawnTeam], 
  578.                                 NO_BOX, 
  579.                                 &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  580.  
  581.                             DisplayString(
  582.                               ReDrawPosnDEFN[EuroReDrawFlag].xposn-
  583.                                   ((PixelLengthOfString( GetTEAMname( DrawnTeam, 11 ), 
  584.                                 MEDIUM_FONT )) /2),
  585.                               ReDrawPosnDEFN[EuroReDrawFlag].yposn,
  586.                                     GetTEAMname( DrawnTeam, 11 ),
  587.                                 MEDIUM_FONT, 
  588.                                 LeagueColourOffsets[DrawnTeam], 
  589.                                 NO_BOX, 
  590.                                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  591.                                        
  592.                             AddToDumpList( 
  593.                                 ReDrawPosnDEFN[EuroReDrawFlag].xposn-84,
  594.                                 ReDrawPosnDEFN[EuroReDrawFlag].yposn,
  595.                                 168, 20 );
  596.  
  597.                             EuroReDrawFlag++;
  598.                             EuroReDrawCounter    =    25;
  599.                         }
  600.  
  601.  
  602.  
  603.                 }
  604.  
  605.     
  606.                 if ( EuroReDrawFlag > -1 && EuroReDrawFlag < 12 )
  607.                 {
  608.                     DrawnTeam    =    (char)( GetRnd2() & 15);
  609.                     
  610.                     if ( DrawnTeam != England &&            
  611.                          DrawnTeam != Spain &&
  612.                          DrawnTeam != Denmark &&
  613.                          DrawnTeam != Germany &&
  614.                          GroupDrawInfo[DrawnTeam] == -1 )
  615.                         {
  616.                             GroupDrawInfo[DrawnTeam] = GroupDrawCode[EuroReDrawFlag];
  617.  
  618.                             DisplayString(
  619.                                   ReDrawPosnDEFN[EuroReDrawFlag].xposn-
  620.                                   ((PixelLengthOfString( GetTEAMname( DrawnTeam, 11 ), 
  621.                                 MEDIUM_FONT )) /2),
  622.                                   ReDrawPosnDEFN[EuroReDrawFlag].yposn,
  623.                                   GetTEAMname( DrawnTeam, 11 ),
  624.                                 MEDIUM_FONT, 
  625.                                 LeagueColourOffsets[DrawnTeam], 
  626.                                 NO_BOX, 
  627.                                 &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  628.  
  629.                             DisplayString(
  630.                                   ReDrawPosnDEFN[EuroReDrawFlag].xposn-
  631.                                   ((PixelLengthOfString( GetTEAMname( DrawnTeam, 11 ), 
  632.                                 MEDIUM_FONT )) /2),
  633.                                   ReDrawPosnDEFN[EuroReDrawFlag].yposn,
  634.                                   GetTEAMname( DrawnTeam, 11 ),
  635.                                 MEDIUM_FONT, 
  636.                                 LeagueColourOffsets[DrawnTeam], 
  637.                                 NO_BOX, 
  638.                                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  639.  
  640.                             AddToDumpList( 
  641.                                 ReDrawPosnDEFN[EuroReDrawFlag].xposn-84,
  642.                                 ReDrawPosnDEFN[EuroReDrawFlag].yposn,
  643.                                 168, 20 );
  644.  
  645.                             EuroReDrawFlag++;
  646.                             EuroReDrawCounter    =    25;
  647.                         }
  648.                 }
  649.     
  650.  
  651.                 if ( EuroReDrawFlag == -1 )
  652.                 {
  653.                     for ( char r=0; r < 16 ; r++ )             
  654.                     {GroupDrawInfo[r]    =    -1;}
  655.                     EuroReDrawFlag        =    0;
  656.                     EuroReDrawCounter    =    25;
  657.                 }
  658.             }
  659.  
  660.             if ( EuroReDrawCounter > 0.0 )
  661.                 EuroReDrawCounter-=    1.85;
  662.  
  663.  
  664.         }
  665.     }
  666.  
  667. //********************************************************************************************************************************
  668.  
  669. void DisplayGroupHeadings()
  670.     {                
  671.         for ( char h=0; h < 4 ; h++ )             
  672.         {
  673.            DisplayString(
  674.                ReDrawHeadPosnDEFN[h].xposn-
  675.                ((PixelLengthOfString( GetTEXT( DRGR_LBLE+h ), 
  676.                MEDIUM_FONT )) /2),
  677.                ReDrawHeadPosnDEFN[h].yposn,
  678.               GetTEXT( DRGR_LBLE+h ),
  679.               MEDIUM_FONT, 
  680.               29,
  681.               NO_BOX, 
  682.               &FrontendPseudoDEFN, &FrontendTextureDEFN  );
  683.  
  684.           AddToDumpList( 
  685.               ReDrawHeadPosnDEFN[h].xposn-84,
  686.               ReDrawHeadPosnDEFN[h].yposn,
  687.               168, 20 );
  688.  
  689.         }
  690.     }
  691.  
  692. //********************************************************************************************************************************
  693.  
  694. void DisplayQualifierGroupHeadings()
  695.     {                
  696.         for ( char h=0; h < 4 ; h++ )             
  697.         {
  698.            DisplayString(
  699.                QualifierHeadPosnDEFN[h].xposn,
  700.                QualifierHeadPosnDEFN[h].yposn,
  701.               GetTEXT( GRQU_LBLS+h ),
  702.               MEDIUM_FONT, 
  703.               29,
  704.               NO_BOX, 
  705.               &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  706.         }
  707.     }
  708.  
  709. //********************************************************************************************************************************
  710.  
  711. void DisplayQualifyingTeams()
  712.     {          
  713.         short    team;
  714.  
  715.          DisplayString( 12, 92,
  716.              GetTEXT (QULY_LBLE),
  717.             LARGE_FONT, 36, NO_BOX, &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  718.         
  719.         for ( char q=0; q < 8 ; q++ )             
  720.         {
  721.         
  722.           team    =    (short)FindTeamInLeague( qualifiers[q].team );
  723.  
  724.            DisplayString( qualifiers[q].xposn-
  725.               (PixelLengthOfString(GetTEAMname( team, 11), LARGE_FONT ) /2 ),
  726.                  qualifiers[q].yposn,
  727.               GetTEAMname( team, 11),
  728.               LARGE_FONT, 43+(7*q), NO_BOX, 
  729.               &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  730.  
  731.             LoadPalette( BIN_TBUL_PAL+( 8*team ),
  732.              &EuroDATfile[0], (44+(7*q)) );
  733.         }
  734.  
  735.     }
  736.  
  737. //********************************************************************************************************************************
  738.  
  739.  
  740. void    DoFinalRoundFixtures( char MENU, signed char BOX )
  741.     {
  742.         if ( MENU == QUALIFIERS && LogicState == RUN_FRONTEND )
  743.         {
  744.             if ( BOX == NXT_MTCH_BOX && ButtonState != 0 )
  745.               {
  746.                 Animation_table[NextMatchHandle].AnimationSpeed = 
  747.                         WhichButton( ButtonState, 0.85);
  748.                 ChangeMenu    =    QUARTER_FINALS;
  749.                      DeBounce      =     TRUE;
  750.               }                                     
  751.     
  752.             NextMatchHighlight = ControlOptionHighlight( BOX, NXT_MTCH_BOX, NXT_MTCHdisp_BOX, NextMatchHighlight,
  753.                         NextMatchHandle, BUTN_LBLS+NextMatch );
  754.         }
  755.  
  756.         if ( ( MENU == QUARTER_FINALS || MENU == SEMI_FINALS || MENU == FINAL_MATCH ) 
  757.                 && LogicState == RUN_FRONTEND )
  758.         {
  759.             if ( BOX == NXT_MTCH_BOX && ButtonState != 0 )
  760.               {
  761.                 EUROteamA    =    FindNextFixtureTeam( Fixtures[MatchNumber].HomeTeam );
  762.                 EUROteamB    =    FindNextFixtureTeam( Fixtures[MatchNumber].AwayTeam );
  763.                 Animation_table[NextMatchHandle].AnimationSpeed = 
  764.                         WhichButton( ButtonState, 0.85);
  765.  
  766.                 if ( MatchNumber==28 && MENU==QUARTER_FINALS )
  767.                 {
  768.                        ChangeMenu    =    SEMI_FINALS;
  769.                            GroupDrawInfo[Results[24].WinningTeam] = TEAM_1q;
  770.                            GroupDrawInfo[Results[25].WinningTeam] = TEAM_2q;
  771.                            GroupDrawInfo[Results[26].WinningTeam] = TEAM_3q;
  772.                            GroupDrawInfo[Results[27].WinningTeam] = TEAM_4q;
  773.                 }
  774.  
  775.                 else
  776.  
  777.                 if ( MatchNumber==30 && MENU==SEMI_FINALS)
  778.                 {
  779.                     ChangeMenu    =    FINAL_MATCH;
  780.                            GroupDrawInfo[Results[28].WinningTeam] = TEAM_1s;
  781.                            GroupDrawInfo[Results[29].WinningTeam] = TEAM_2s;
  782.                 }
  783.  
  784.                 else
  785.  
  786.                       ChangeMenu    =    NEXT_MATCH;
  787.  
  788.  
  789.                      DeBounce     =     TRUE;
  790.               }                                     
  791.     
  792.             NextMatchHighlight = ControlOptionHighlight( BOX, NXT_MTCH_BOX, NXT_MTCHdisp_BOX, NextMatchHighlight,
  793.                         NextMatchHandle, BUTN_LBLS+NextMatch );
  794.         }
  795.  
  796.  
  797.     }
  798.  
  799. //********************************************************************************************************************************
  800.  
  801. void DisplayFinalRoundFixtures( char Match, char MENU )
  802.     {          
  803.         char    n;
  804.         char    ammount[5];
  805.         char    NextMtch;
  806.         char    *Outcome;
  807.  
  808.         NextMtch = Match;
  809.         
  810.         if ( MENU == QUARTER_FINALS )
  811.         {
  812.             Match     = 24;
  813.             n    = 4;
  814.         }
  815.  
  816.         else
  817.  
  818.         if ( MENU == SEMI_FINALS )
  819.         {
  820.             Match     = 28;
  821.             n    = 2;
  822.         }
  823.  
  824.         else
  825.             n    = 1;
  826.  
  827.  
  828.         for ( char f=0; f < n ; f++ )
  829.         {
  830.  
  831.         LoadPalette( BIN_TBUL_PAL+( 8*FindNextFixtureTeam( Fixtures[Match].HomeTeam ) ),
  832.          &EuroDATfile[0], (44+(14*f)) );
  833.  
  834.         LoadPalette( BIN_TBUL_PAL+( 8*FindNextFixtureTeam( Fixtures[Match].AwayTeam ) ),
  835.          &EuroDATfile[0], (44+7+(14*f)) );
  836.  
  837.             if ( Match<NextMtch )
  838.             {            
  839.             
  840.             char ResText[128];
  841.  
  842.             strcpy(ResText, GetTEAMname( FindNextFixtureTeam( Fixtures[Match].HomeTeam ), 11) );
  843.             strcat(ResText, "   ");
  844.                    itoa( (int)Results[Match].HomeScore, EUROammount, 10);
  845.             strcat(ResText, EUROammount);
  846.  
  847.  
  848.             DisplayString(
  849.                 Fixtures[Match].fixXposn-
  850.                     (PixelLengthOfString( 
  851.                 ResText, LARGE_FONT ) /2 ),
  852.                 Fixtures[Match].fixYposn,
  853.                       ResText, LARGE_FONT, 
  854.                 (43+(14*f)), NO_BOX, 
  855.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  856.  
  857.  
  858.             strcpy(ResText, GetTEAMname( FindNextFixtureTeam( Fixtures[Match].AwayTeam ), 11) );
  859.             strcat(ResText, "   ");
  860.                    itoa( (int)Results[Match].AwayScore, EUROammount, 10);
  861.             strcat(ResText, EUROammount);
  862.  
  863.             DisplayString(
  864.                 (Fixtures[Match].fixXposn+188)-
  865.                     (PixelLengthOfString( 
  866.                 ResText, LARGE_FONT ) /2 ),
  867.                 Fixtures[Match].fixYposn,
  868.                       ResText, LARGE_FONT, 
  869.                 (50+(14*f)), NO_BOX, 
  870.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  871.  
  872.             Outcome    = StringTemplete( RSLT_TEXT+Results[Match].Message, Match );
  873.  
  874.             DisplayString( 226-(PixelLengthOfString( Outcome, SMALL_FONT ) /2 ), 
  875.                 Fixtures[Match].fixYposn+39,
  876.                 Outcome, SMALL_FONT, 15, NO_BOX, 
  877.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  878.             }
  879.             
  880.             else
  881.  
  882.             {
  883.  
  884.             DisplayString(
  885.                 Fixtures[Match].fixXposn-
  886.                     (PixelLengthOfString( 
  887.                 GetTEAMname( FindNextFixtureTeam( Fixtures[Match].HomeTeam ), 11), LARGE_FONT ) /2 ),
  888.                 Fixtures[Match].fixYposn,
  889.                       GetTEAMname( FindNextFixtureTeam( Fixtures[Match].HomeTeam ), 11), LARGE_FONT, 
  890.                 (43+(14*f)), NO_BOX, 
  891.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  892.  
  893.             DisplayString(
  894.                 (Fixtures[Match].fixXposn+188)-
  895.                     (PixelLengthOfString( 
  896.                 GetTEAMname( FindNextFixtureTeam( Fixtures[Match].AwayTeam), 11), LARGE_FONT ) /2 ),
  897.                 Fixtures[Match].fixYposn,
  898.                       GetTEAMname( FindNextFixtureTeam( Fixtures[Match].AwayTeam), 11), LARGE_FONT, 
  899.                 (50+(14*f)), NO_BOX, 
  900.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  901.  
  902.  
  903.         // date of match
  904.  
  905.             DisplayString( 
  906.                 Fixtures[Match].fixXposn-74,
  907.                 Fixtures[Match].fixYposn+39,
  908.                       GetTEXT( DATE_LBLS+Match ),
  909.                 SMALL_FONT, 15, NO_BOX, 
  910.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  911.  
  912.         // venue of match
  913.  
  914.             DisplayString( 
  915.                 Fixtures[Match].fixXposn+260-
  916.                     (PixelLengthOfString(GetTEXT( VNUE_NMES+MatchVenues[Match] ), SMALL_FONT ) ), 
  917.                 Fixtures[Match].fixYposn+39,
  918.                       GetTEXT( VNUE_NMES+MatchVenues[Match] ),
  919.                 SMALL_FONT, 15, NO_BOX, 
  920.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  921.  
  922.         // versus symbol
  923.  
  924.             DisplayString( 
  925.                 226-
  926.                 (PixelLengthOfString(GetTEXT( VRUS_LBLE ), LARGE_FONT ) /2 ), 
  927.                 Fixtures[Match].fixYposn,
  928.                       GetTEXT( VRUS_LBLE ),
  929.                 LARGE_FONT, 22, NO_BOX, 
  930.                 &FrontendBackgroundDEFN, &FrontendTextureDEFN  );
  931.             }
  932.  
  933.  
  934.             Match++;
  935.         }
  936.     }
  937.  
  938. //********************************************************************************************************************************
  939.